#!/bin/bash
# 安装kubelet kubeadm kubectl三大组建
apt-get update
sudo apt-get install -y kubelet kubeadm kubectl
sudo apt-mark hold kubelet kubeadm kubectl
# 重新启动kubelet
systemctl daemon-reload
systemctl restart docker
# 查看需要安装的必要镜像：
kubeadm config images list --kubernetes-version v1.14.1
# 初始化集群前检查所需的docker镜像
kubeadm config images pull
docker pull k8s.gcr.io/kube-apiserver:v1.14.1
docker pull k8s.gcr.io/kube-controller-manager:v1.14.1
docker pull k8s.gcr.io/kube-scheduler:v1.14.1
docker pull k8s.gcr.io/kube-proxy:v1.14.1
docker pull k8s.gcr.io/pause:3.1
docker pull k8s.gcr.io/etcd:3.3.10
docker pull k8s.gcr.io/coredns:1.3.1
docker pull k8s.gcr.io/kubernetes-dashboard-amd64:v1.10.1
docker pull quay.io/coreos/flannel:v0.9.1-amd64
# 安装flannel  ready for flannel net 
sudo mkdir -p /etc/cni/net.d/
wget https://gitee.com/ACANX/K8S-Config/raw/master/install/10-flannel.conf
sudo cp 10-flannel.conf /etc/cni/net.d/10-flannel.conf

mkdir /usr/share/oci-umount/oci-umount.d -p
mkdir /run/flannel/
wget https://gitee.com/ACANX/K8S-Config/raw/master/install/subnet.env
sudo cp subnet.env /run/flannel/subnet.env